//
//  FINEmojiKeyboardView.h
//  AGEmojiKeyboard
//
//  Created by Ayush on 09/05/13, updated by zhangxiaolian from jiaoliao on 2014-10-16
//  Copyright (c) 2013 Ayush and zhangxiaolian. All rights reserved.
//
// Set as inputView to textfields, this view class gives an
// interface to the user to enter emoji characters.

#import <UIKit/UIKit.h>

static const CGFloat ButtonWidth = 26;
static const CGFloat ButtonHeight = 26;

typedef NS_ENUM(NSInteger, FINEmojiKeyboardViewCategoryImage) {
  FINEmojiKeyboardViewCategoryImageRecent,
  FINEmojiKeyboardViewCategoryImageFace,
  FINEmojiKeyboardViewCategoryImageBell,
  FINEmojiKeyboardViewCategoryImageFlower,
  FINEmojiKeyboardViewCategoryImageCar,
  FINEmojiKeyboardViewCategoryImageCharacters
};

@protocol FINEmojiKeyboardViewDelegate;
@protocol FINEmojiKeyboardViewDataSource;

/**
 Keyboard class to present as an alternate.
 This keyboard presents the emojis supported by iOS.
 */
@interface FINEmojiKeyboardView : UIView


@property (nonatomic, weak) id<FINEmojiKeyboardViewDelegate> delegate;
@property (nonatomic, weak) id<FINEmojiKeyboardViewDataSource> dataSource;
@property (nonatomic, strong) UIScrollView *scrollView;

/**
 @param frame Frame of the view to be initialised with.

 @param dataSource dataSource is required during the initialization to
 get all the relevent images to present in the view.
 */
- (instancetype)initWithFrame:(CGRect)frame
                   dataSource:(id<FINEmojiKeyboardViewDataSource>)dataSource;

- (void)setSendButtonEnable:(BOOL)enabled;
@end


/**
 Protocol to be followed by the dataSource of `FINEmojiKeyboardView`.
 */
@protocol FINEmojiKeyboardViewDataSource <NSObject>

/**
 Method called on dataSource to get the category image when selected.

 @param emojiKeyboardView EmojiKeyBoardView object on which user has tapped.

 @param category category to get the image for. @see FINEmojiKeyboardViewCategoryImage
 */
- (UIImage *)emojiKeyboardView:(FINEmojiKeyboardView *)emojiKeyboardView
      imageForSelectedCategory:(FINEmojiKeyboardViewCategoryImage)category;

/**
 Method called on dataSource to get the category image when not-selected.

 @param emojiKeyboardView EmojiKeyBoardView object on which user has tapped.

 @param category category to get the image for. @see FINEmojiKeyboardViewCategoryImage
 */
- (UIImage *)emojiKeyboardView:(FINEmojiKeyboardView *)emojiKeyboardView
   imageForNonSelectedCategory:(FINEmojiKeyboardViewCategoryImage)category;

/**
 Method called on dataSource to get the back button image to be shown in the view.

 @param emojiKeyboardView EmojiKeyBoardView object on which user has tapped.
 */
- (UIImage *)backSpaceButtonImageForEmojiKeyboardView:(FINEmojiKeyboardView *)emojiKeyboardView;

@optional

/**
 Method called on dataSource to get category that should be shown by
 default i.e. when the keyboard is just presented.

 @note By default `FINEmojiKeyboardViewCategoryImageRecent` is shown.

 @param emojiKeyboardView EmojiKeyBoardView object shown.
 */
- (FINEmojiKeyboardViewCategoryImage)defaultCategoryForEmojiKeyboardView:(FINEmojiKeyboardView *)emojiKeyboardView;

/**
 Method called on dataSource to get number of emojis to be maintained in
 recent category.

 @note By default `50` is used.

 @param emojiKeyboardView EmojiKeyBoardView object shown.
 */
- (NSUInteger)recentEmojisMaintainedCountForEmojiKeyboardView:(FINEmojiKeyboardView *)emojiKeyboardView;

@end


/**
 Protocol to be followed by the delegate of `FINEmojiKeyboardView`.
 */
@protocol FINEmojiKeyboardViewDelegate <NSObject>

/**
 Delegate method called when user taps an emoji button

 @param emojiKeyBoardView EmojiKeyBoardView object on which user has tapped.

 @param emoji Emoji used by user
 */
- (void)emojiKeyBoardView:(FINEmojiKeyboardView *)emojiKeyBoardView
              didUseEmoji:(NSString *)emoji;

/**
 Delegate method called when user taps on the backspace button

 @param emojiKeyBoardView EmojiKeyBoardView object on which user has tapped.
 */
- (void)emojiKeyBoardViewDidPressBackSpace:(FINEmojiKeyboardView *)emojiKeyBoardView;

/**
 Delegate method called when user taps on the send button
 
 @param emojiKeyBoardView EmojiKeyBoardView object on which user has tapped.
 */
- (void)emojiKeyBoardViewDidPressSend:(FINEmojiKeyboardView *)emojiKeyBoardView;

@end
